package com.itheima.user.mapper;

import com.itheima.user.domain.po.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Select("select * from tb_user where phone = #{phone} and pwd = #{pwd}")
    User selectOne(String phone, String pwd);

    @Insert("insert into tb_user(name,gender,id_no,phone,pwd,email) values" +
            "(#{name},#{gender},#{idNo},#{phone},#{pwd},#{email})")
    int insert(User user);

    @Delete("delete from tb_user where id = #{id}")
    int deleteById(Long id);

    int updateById(User user);

    @Select("select * from tb_user where id = #{id}")
    User selectById(Long id);
}
